home *** CD-ROM | disk | FTP | other *** search
/ La Traviata / La Traviata.iso / viewer / gifsrc.zip / SCROLL.ASM < prev    next >
Assembly Source File  |  1988-02-03  |  4KB  |  96 lines

  1. ;****************************************************************************
  2. ;Written 1/29-2/4/88 by Jim Griebel.
  3. ;Scroll the EGA picture if it is larger than the screen. Scrolling is
  4. ;accomplished by mapping the 4 bitplane arrays maintained on the Turbo
  5. ;heap back into EGA memory in Write Mode 0. We add an offset value to
  6. ;the starting addresses of these arrays in order to move the picture up
  7. ;or down on the screen. This value is the Turbo variable ROLL, adjusted
  8. ;by the Pascal program in response to user inputs.
  9. ;2/3/88 switched from moving the whole bitplane at once to moving bitplanes
  10. ;a scan line at a time. Former produced a 'rainbow' effect during scrolling
  11. ;with some pictures
  12. ;****************************************************************************
  13.  
  14. data          segment public byte
  15.               assume ds: data
  16.  
  17. ;Turbo variables defined for access by this program
  18.  
  19.               extrn plane0:dword,plane1:dword,plane2:dword,plane3:dword
  20.               extrn roll:word
  21.  
  22. data          ends
  23.  
  24. code          segment
  25.               assume cs:code
  26.  
  27.               public scroll
  28.               lroll  dw   ?
  29.  
  30. scroll        proc near
  31.  
  32. ;set up the EGA for new mode; write it a plane at a time
  33.  
  34.               mov   dx,3CEH
  35.               mov   ax,5               ;Register 5=0, write mode 0
  36.               out   dx,ax              ;Trick I learned from Turbo:
  37.                                        ;this puts 5 out 3CE, 0 out 3CF!
  38.               mov   ax,3
  39.               out   dx,ax              ;Register 3=0, no rotate, no mod
  40.               mov   ax,1               ;Register 1=0, turn off S/R
  41.               out   dx,ax
  42.               mov   ax,0FF08H          ;Register 8=255, all bits enabled
  43.               out   dx,ax
  44.               push  ds                 ;Save DS to keep Turbo happy
  45.               mov   ax,0a000h          ;ES gets EGA video RAM segment
  46.               mov   es,ax
  47.               mov   bx,roll            ;BX offset from start of arrays
  48.               mov   lroll,bx
  49. top:          mov   dx,3C4H            ;3C4=2, 3C5=n, where n=plane no.
  50.               mov   ax,0102H           ;data will go to
  51.               out   dx,ax
  52.               pop   ds
  53.               push  ds
  54.               lds   si,plane0          ;Point DS:SI to bitplane on heap
  55.               add   si,bx              ;Add scroll offset if any
  56.               call  putout             ;Rip it out there
  57.               mov   ax,0202H           ;Same code for remaining bitplanes
  58.               out   dx,ax
  59.               pop   ds                 ;Get DS back to fetch next plane
  60.               push  ds
  61.               lds   si,plane1
  62.               add   si,bx
  63.               call  putout
  64.               mov   ax,0402h
  65.               out   dx,ax
  66.               pop   ds
  67.               push  ds
  68.               lds   si,plane2
  69.               add   si,bx
  70.               call  putout
  71.               mov   ax,0802h
  72.               out   dx,ax
  73.               pop   ds
  74.               push  ds
  75.               lds   si,plane3
  76.               add   si,bx
  77.               call  putout
  78.               add   bx,80
  79.               cmp   bx,38400
  80.               jnz   top
  81.               pop   ds
  82.               ret
  83. scroll        endp
  84.  
  85. putout        proc  near
  86.               cld
  87.               mov   cx,80              ;Size of scan line
  88.               mov   di,bx              ;Point to start of EGA RAM
  89.               sub   di,lroll
  90.               repz  movsb              ;and crank in the bitplane
  91.               ret                      ;Done
  92. putout        endp
  93.  
  94.               code  ends
  95.               end   scroll
  96.               end